from lib2to3.pgen2 import driver

from config import PATH
from page.page_register import RegisterPage
from script import log
from tools import DriverTools


class TestRegister(object):
    def setup_method(self):
        # 打开浏览器
        self.driver = DriverTools.get_driver()
        # 输入网址
        self.driver.get('http://121.43.169.97:8081/common/member/reg')
        # 输入手机号 密码 验证码.....
        self.reg = RegisterPage(self.driver)

    def teardown_method(self):
        # 关闭浏览器
        DriverTools.quit_driver()

    def test01_reg_success(self):
        self.reg.register('13865566578', 'w123456')
        result = self.reg.get_success_result()
        assert '恭喜您，注册成功' in result
        # print(result)
        log.info(f'执行结果:{result}')

        self.reg.get_shot('pwd_error.png')

    # def test02_reg_fail(self):
    #     self.reg.register('13805158888', 'w123456')
    #     result = self.reg.get_fail_result()
    #     assert '注册抢88现金' in result
    #     print(result)
    #     self.reg.get_shot('pwd_error1.png')
